package com.geek.javase.ch01.test;

/*
 *@author wangpeng
 *2025/10/9 17:01
 *@description TODO
 */
/**
 * 皇帝类
 * 封装皇帝的基本信息和政绩
 */
public class Emperor {
    // 私有化属性
    private String name;        // 姓名
    private String reignPeriod; // 在位时间
    private String achievements;// 政绩
    private String description; // 描述

    // 无参构造方法
    public Emperor() {
    }

    // 带参构造方法
    public Emperor(String name, String reignPeriod, String achievements, String description) {
        this.name = name;
        this.reignPeriod = reignPeriod;
        this.achievements = achievements;
        this.description = description;
    }

    // getter和setter方法
    //获取皇帝姓名
    public String getName() {
        return name;
    }

    //设置皇帝姓名
    public void setName(String name) {
        this.name = name;
    }

    //获取在位时间
    public String getReignPeriod() {
        return reignPeriod;
    }

    //设置在位时间
    public void setReignPeriod(String reignPeriod) {
        this.reignPeriod = reignPeriod;
    }

    //获取政绩
    public String getAchievements() {
        return achievements;
    }

    //设置政绩
    public void setAchievements(String achievements) {
        this.achievements = achievements;
    }

    //获取描述
    public String getDescription() {
        return description;
    }

    //设置描述
    public void setDescription(String description) {
        this.description = description;
    }

    //显示所有属性信息
    public void displayInfo() {
        System.out.println("========== 皇帝信息 ==========");
        System.out.println("姓名: " + name);
        System.out.println("在位时间: " + reignPeriod);
        System.out.println("主要政绩: " + achievements);
        System.out.println("历史评价: " + description);
        System.out.println("============================");
    }
}
